"""
URL configuration for webServer project.

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/5.1/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""




from django.contrib import admin
from django.urls import path, include, re_path
from rest_framework.routers import DefaultRouter
from app.views import UserViewSet,LoginView,CompanyViewSet,ActivityViewSet,ContactViewSet,SchedulingViewSet,RegistrationViewSet
from rest_framework_simplejwt.views import token_obtain_pair, token_verify, TokenRefreshView

router = DefaultRouter()
router.register(r'user', UserViewSet,basename="user")
router.register(r'company', CompanyViewSet,basename="company")
router.register(r'activity', ActivityViewSet,basename="activity")
router.register(r'contact', ContactViewSet,basename="contact")
router.register(r'scheduling', SchedulingViewSet,basename="scheduling")
router.register(r'registration', RegistrationViewSet,basename="registration")
urlpatterns = [
    # path('api/token/', token_obtain_pair),  # 登录  签发token
    
    path("admin/", admin.site.urls),
    path('api/', include(router.urls)),
    path('api/login/', LoginView.as_view(), name='login'),
    path('api/token/verify/', token_verify),  # 验证token 是否有效
    path('api/token/refresh/', TokenRefreshView.as_view()),  # 刷新token
    path('api-auth/', include('rest_framework.urls', namespace='rest_framework'))
]
